package com.rain.rainspringboot3.order.enums;

import lombok.Getter;

@Getter
public enum OrderTypeEnum {
    //作者共同体
    AUTHOR_COMMUNITY("AUTHOR_COMMUNITY", 1, "作者共同体"),
    // 稿件服务
    ARTICLE_SERVICE("ARTICLE_SERVICE", 2, "稿件服务"),
    // 合作刊检测
    COOPERATION_JOURNAL_CHECK("COOPERATION_JOURNAL_CHECK", 3, "合作刊检测"),
    // 智能荐刊
    SMART_RECOMMEND_JOURNAL("SMART_RECOMMEND_JOURNAL", 4, "智能荐刊"),
    // 稿件订单
    ARTICLE_ORDER("ARTICLE_ORDER", 5, "稿件订单"),
    // 整本清样订单
    WHOLE_BOOK_CLEAN_ORDER("WHOLE_BOOK_CLEAN_ORDER", 6, "整本清样订单");

    private String name;
    private Integer code;
    private String desc;
    OrderTypeEnum(String name, Integer code, String desc){
        this.name = name;
        this.code = code;
        this.desc = desc;
    }

    public static OrderTypeEnum getByCode(Integer code) {
        for (OrderTypeEnum value : OrderTypeEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }

}